• DingiStyleLayer is an abstract base class for style layers. A style layer manages the layout and appearance of content at a specific z-index in a style. An DingiStyle object consists of one or more DingiStyleLayer objects.

    Each style layer defined by the style JSON file is represented at runtime by an DingiStyleLayer object, which you can use to refine the map’s appearance. You can also add and remove style layers dynamically.

    Create instances of DingiBackgroundStyleLayer and the concrete subclasses of DingiForegroundStyleLayer in order to use DingiStyleLayer‘s properties and methods. You do not create instances of DingiStyleLayer directly, and do not create your own subclasses of this class.

    Do not add DingiStyleLayer objects to the style property of a DingiMapView before -mapView:didFinishLoadingStyle: is called.

    See more

    Declaration

    Objective-C

    
    @interface DingiStyleLayer : NSObject

    Swift

    class DingiStyleLayer : NSObject
  • An DingiBackgroundStyleLayer is a style layer that covers the entire map. Use a background style layer to configure a color or pattern to show below all other map content. If the style’s other layers use the Mapbox Streets source, the background style layer is responsible for drawing land, whereas the oceans and other bodies of water are drawn by DingiFillStyleLayer objects.

    A background style layer is typically the bottommost layer in a style, because it covers the entire map and can occlude any layers below it. You can therefore access it by getting the last item in the DingiStyle.layers array.

    If the background style layer is transparent or omitted from the style, any portion of the map view that does not show another style layer is transparent.

    See more

    Declaration

    Objective-C

    
    @interface DingiBackgroundStyleLayer : DingiStyleLayer

    Swift

    class DingiBackgroundStyleLayer : DingiStyleLayer
  • An DingiRasterStyleLayer is a style layer that renders georeferenced raster imagery on the map, especially raster tiles.

    Use a raster style layer to configure the color parameters of raster tiles loaded by an DingiRasterTileSource object or raster images loaded by an DingiImageSource object. For example, you could use a raster style layer to render Mapbox Satellite imagery, a raster tile set uploaded to Mapbox Studio, or a raster map authored in TileMill, the classic Mapbox Editor, or Mapbox Studio Classic.

    Raster images may also be used as icons or patterns in a style layer. To register an image for use as an icon or pattern, use the -[DingiStyle setImage:forName:] method. To configure a point annotation’s image, use the DingiAnnotationImage class.

    You can access an existing raster style layer using the -[DingiStyle layerWithIdentifier:] method if you know its identifier; otherwise, find it using the DingiStyle.layers property. You can also create a new raster style layer and add it to the style using a method such as -[DingiStyle addLayer:].

    Example

    let layer = DingiRasterStyleLayer(identifier: "clouds", source: source)
    layer.rasterOpacity = NSExpression(forConstantValue: 0.5)
    mapView.style?.addLayer(layer)
    
    See more

    Declaration

    Objective-C

    
    @interface DingiRasterStyleLayer : DingiForegroundStyleLayer

    Swift

    class DingiRasterStyleLayer : DingiForegroundStyleLayer
  • An DingiCircleStyleLayer is a style layer that renders one or more filled circles on the map.

    Use a circle style layer to configure the visual appearance of point or point collection features. These features can come from vector tiles loaded by an DingiVectorTileSource object, or they can be DingiPointAnnotation, DingiPointFeature, DingiPointCollection, or DingiPointCollectionFeature instances in an DingiShapeSource or DingiComputedShapeSource object.

    A circle style layer renders circles whose radii are measured in screen units. To display circles on the map whose radii correspond to real-world distances, use many-sided regular polygons and configure their appearance using an DingiFillStyleLayer object.

    You can access an existing circle style layer using the -[DingiStyle layerWithIdentifier:] method if you know its identifier; otherwise, find it using the DingiStyle.layers property. You can also create a new circle style layer and add it to the style using a method such as -[DingiStyle addLayer:].

    Example

    let layer = DingiCircleStyleLayer(identifier: "circles", source: population)
    layer.sourceLayerIdentifier = "population"
    layer.circleColor = NSExpression(forConstantValue: UIColor.green)
    layer.circleRadius = NSExpression(format: "mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'exponential', 1.75, %@)",
                                      [12: 2,
                                       22: 180])
    layer.circleOpacity = NSExpression(forConstantValue: 0.7)
    layer.predicate = NSPredicate(format: "%K == %@", "marital-status", "married")
    mapView.style?.addLayer(layer)
    
    See more

    Declaration

    Objective-C

    
    @interface DingiCircleStyleLayer : DingiVectorStyleLayer

    Swift

    class DingiCircleStyleLayer : DingiVectorStyleLayer
  • An DingiFillExtrusionStyleLayer is a style layer that renders one or more 3D extruded polygons on the map.

    Use a fill-extrusion style layer to configure the visual appearance of polygon or multipolygon features. These features can come from vector tiles loaded by an DingiVectorTileSource object, or they can be DingiPolygon, DingiPolygonFeature, DingiMultiPolygon, or DingiMultiPolygonFeature instances in an DingiShapeSource or DingiComputedShapeSource object.

    You can access an existing fill-extrusion style layer using the -[MGLStyle layerWithIdentifier:] method if you know its identifier; otherwise, find it using the MGLStyle.layers property. You can also create a new fill-extrusion style layer and add it to the style using a method such as -[MGLStyle addLayer:].

    Example

    let layer = DingiFillExtrusionStyleLayer(identifier: "buildings", source: buildings)
    layer.sourceLayerIdentifier = "building"
    layer.fillExtrusionHeight = NSExpression(forKeyPath: "height")
    layer.fillExtrusionBase = NSExpression(forKeyPath: "min_height")
    layer.predicate = NSPredicate(format: "extrude == 'true'")
    mapView.style?.addLayer(layer)
    
    See more

    Declaration

    Objective-C

    
    @interface DingiFillExtrusionStyleLayer : DingiVectorStyleLayer

    Swift

    class DingiFillExtrusionStyleLayer : DingiVectorStyleLayer
  • An DingiHillshadeStyleLayer is a style layer that renders raster digital elevation model (DEM) tiles on the map.

    Use a hillshade style layer to configure the color parameters of raster tiles loaded by an DingiRasterDEMSource object. For example, you could use a hillshade style layer to render Mapbox Terrain-RGB data.

    To display posterized hillshading based on vector shapes, as with the Mapbox Terrain source, use an DingiVectorTileSource object in conjunction with several DingiFillStyleLayer objects.

    You can access an existing hillshade style layer using the -[MGLStyle layerWithIdentifier:] method if you know its identifier; otherwise, find it using the MGLStyle.layers property. You can also create a new hillshade style layer and add it to the style using a method such as -[MGLStyle addLayer:].

    Example

    let layer = DingiHillshadeStyleLayer(identifier: "hills", source: source)
    layer.hillshadeExaggeration = NSExpression(forConstantValue: 0.6)
    if let canalShadowLayer = mapView.style?.layer(withIdentifier: "waterway-river-canal-shadow") {
        mapView.style?.insertLayer(layer, below: canalShadowLayer)
    }
    
    See more

    Declaration

    Objective-C

    
    @interface DingiHillshadeStyleLayer : DingiForegroundStyleLayer

    Swift

    class DingiHillshadeStyleLayer : DingiForegroundStyleLayer
  • An DingiLineStyleLayer is a style layer that renders one or more stroked polylines on the map.

    Use a line style layer to configure the visual appearance of polyline or multipolyline features. These features can come from vector tiles loaded by an DingiVectorTileSource object, or they can be DingiPolyline, DingiPolylineFeature, DingiMultiPolyline, or DingiMultiPolylineFeature instances in an DingiShapeSource or DingiComputedShapeSource object.

    You can access an existing line style layer using the -[MGLStyle layerWithIdentifier:] method if you know its identifier; otherwise, find it using the MGLStyle.layers property. You can also create a new line style layer and add it to the style using a method such as -[MGLStyle addLayer:].

    Example

    let layer = DingiLineStyleLayer(identifier: "trails-path", source: trails)
    layer.sourceLayerIdentifier = "trails"
    layer.lineWidth = NSExpression(format: "mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'exponential', 1.5, %@)",
                                   [14: 2,
                                    18: 20])
    layer.lineColor = NSExpression(forConstantValue: UIColor.brown)
    layer.lineCap = NSExpression(forConstantValue: "round")
    layer.predicate = NSPredicate(format: "%K == %@", "trail-type", "mountain-biking")
    mapView.style?.addLayer(layer)
    
    See more

    Declaration

    Objective-C

    
    @interface DingiLineStyleLayer : DingiVectorStyleLayer

    Swift

    class DingiLineStyleLayer : DingiVectorStyleLayer
  • An DingiSymbolStyleLayer is a style layer that renders icon and text labels at points or along lines on the map.

    Use a symbol style layer to configure the visual appearance of feature labels. These features can come from vector tiles loaded by an DingiVectorTileSource object, or they can be DingiShape or DingiFeature instances in an DingiShapeSource or DingiComputedShapeSource object.

    You can access an existing symbol style layer using the -[DingiStyle layerWithIdentifier:] method if you know its identifier; otherwise, find it using the DingiStyle.layers property. You can also create a new symbol style layer and add it to the style using a method such as -[DingiStyle addLayer:].

    Example

    let layer = DingiSymbolStyleLayer(identifier: "coffeeshops", source: pois)
    layer.sourceLayerIdentifier = "pois"
    layer.iconImageName = NSExpression(forConstantValue: "coffee")
    layer.iconScale = NSExpression(forConstantValue: 0.5)
    layer.text = NSExpression(forKeyPath: "name")
    layer.textTranslation = NSExpression(forConstantValue: NSValue(cgVector: CGVector(dx: 10, dy: 0)))
    layer.textJustification = NSExpression(forConstantValue: "left")
    layer.textAnchor = NSExpression(forConstantValue: "left")
    layer.predicate = NSPredicate(format: "%K == %@", "venue-type", "coffee")
    mapView.style?.addLayer(layer)
    
    See more

    Declaration

    Objective-C

    
    @interface DingiSymbolStyleLayer : DingiVectorStyleLayer

    Swift

    class DingiSymbolStyleLayer : DingiVectorStyleLayer